package com.course.service.impl;

import com.course.dao.CoursesMapper;
import com.course.pojo.Courses;
import com.course.service.CoursesService;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

@Service
public class CoursesServiceimpl implements CoursesService{
    private CoursesMapper coursesmapper;

    @Override
    public int deleteByPrimaryKey(String coursesid) {
        return coursesmapper.deleteByPrimaryKey(coursesid);
    }

    @Override
    public int insert(Courses record) {
        return coursesmapper.insert(record);
    }

    @Override
    public int insertSelective(Courses record) {
        return coursesrmapper.insertSelective(record);
    }

    @Override
    public String selectByPrimaryKey(String coursesid) {
        return coursesmapper.selectByPrimaryKey(coursesid);
    }

    @Override
    public int updateByPrimaryKeySelective(Courses record) {
        return coursesmapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Courses record) {
        return coursesmapper.updateByPrimaryKey(record);
    }

    @Override
    public String addCourses(String coursesid,String coursename)
    {
        Courses course = new Courses();
        course.setCourseid(coursesid);
        course.setCoursename(coursename);
        int i = coursesMapper.updateByPrimaryKeySelective(course);
        if(i==1){
            return "200";
        }
        return "400";
    }

}